var core = require('core');
var db = core.db;
var send = core.send;
var getToken = function(req, res, next){

    var body = req.body;
    var type = body.type;
    var token = body.token;
    var SEND;
    db.schema[type].remove({token: token}, function(err){
        if(err){
            SEND = new send(100000);
            console.error(err);
        }else{
            SEND = new send(0);
        };

        res.send(SEND);
    });

};

module.exports = getToken;
